#include "cpu/exec/template-start.h"

#define instr sub

static void do_execute () {
	DATA_TYPE_S result = op_dest->val - op_src->val;
	OPERAND_W(op_dest, result);

	/* TODO: Update EFLAGS. */
    cpu.CF = (result < 0);
    cpu.PF = ~(result ^ (result >> 1) ^ (result >> 2) ^ (result >> 3) ^ (result >> 4) ^ (result >> 5) ^ (result >> 6) ^ (result >> 7)) & 1;
    cpu.AF = 0;
	cpu.ZF = (result == 0);
	cpu.OF = 0;

	print_asm_template1();
}

#if DATA_BYTE == 2 || DATA_BYTE == 4
make_instr_helper(si2rm)
make_instr_helper(i2rm)
#endif
make_instr_helper(r2rm)

#include "cpu/exec/template-end.h"
